Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
minor UI modification
Browse files Browse the repository at this point in the history
  • Loading branch information
Cenmrev committed Dec 25, 2018
1 parent b68bf65 commit ff57615
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion V2RayX/AdvancedWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ - (BOOL)checkOutbound {
NSError *e;
NSDictionary* newOutboud = [NSJSONSerialization JSONObjectWithData:[_outboundJsonView.string dataUsingEncoding:NSUTF8StringEncoding] options:0 error:&e];
if (e) {
[self showAlert:@"not a valid json"];
[self showAlert:@"NOT a valid json"];
[_outboundTable selectRowIndexes:[NSIndexSet indexSetWithIndex:_selectedOutbound] byExtendingSelection:NO];
return NO;
} else {
Expand Down
2 changes: 1 addition & 1 deletion V2RayX/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ - (void)updateServerMenuList {
} else {
int i = 0;
for (NSDictionary *p in profiles) {
NSString *itemTitle = [NSString stringWithFormat:@"%@:%@",p[@"protocol"], p[@"tag"]];
NSString *itemTitle = nilCoalescing(p[@"tag"], @"");
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:itemTitle action:@selector(switchServer:) keyEquivalent:@""];
[newItem setTag:i];
if (useMultipleServer){
Expand Down
5 changes: 3 additions & 2 deletions V2RayX/ConfigWindow.xib
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<clipView key="contentView" ambiguous="YES" drawsBackground="NO" id="0kH-bt-ahk">
<rect key="frame" x="1" y="1" width="138" height="181"/>
<autoresizingMask key="autoresizingMask"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnResizing="NO" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" id="fje-9q-W5F">
<rect key="frame" x="0.0" y="0.0" width="138" height="181"/>
Expand Down Expand Up @@ -603,7 +603,7 @@ Gw
<action selector="importFromJSONFiles:" target="-2" id="bWI-hd-Wef"/>
</connections>
</menuItem>
<menuItem title="Import from standard SS share links..." id="CTZ-Lq-X8f">
<menuItem title="Import from standard share links..." id="CTZ-Lq-X8f">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="importFromStandardLink:" target="-2" id="prN-IG-Awe"/>
Expand All @@ -612,6 +612,7 @@ Gw
<menuItem title="Import from pastboard..." hidden="YES" id="EQb-nS-Lf9">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="HUE-ih-p3S"/>
<menuItem title="Import from other miscellaneous links..." id="8rA-16-mml">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
Expand Down
14 changes: 8 additions & 6 deletions V2RayX/ConfigWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,13 @@ - (void)askInputWithPrompt: (NSString*)prompt handler:(void (^ __nullable)(NSStr
alternateButton:@"Cancel"
otherButton:nil
informativeTextWithFormat:@""];
NSTextField *input = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 400, 24)];
[alert setAccessoryView:input];
NSTextField *inputField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 400, 24)];
inputField.usesSingleLineMode = true;
inputField.lineBreakMode = NSLineBreakByTruncatingHead;
[alert setAccessoryView:inputField];
[alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse returnCode) {
if (returnCode == NSModalResponseOK) {
handler([input stringValue]);
handler([inputField stringValue]);
}
}];
}
Expand All @@ -302,7 +304,7 @@ - (void)showAlert:(NSString*)text {
}

- (IBAction)importFromStandardLink:(id)sender {
[self askInputWithPrompt:@"Please input the server info with standard and official format" handler:^(NSString *inputStr) {
[self askInputWithPrompt:@"Support standard ss:// link. Use \"Import from other miscellaneous links...\" to import other links(may cause failure)." handler:^(NSString *inputStr) {
if (inputStr.length) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
NSMutableDictionary* ssOutbound = [ConfigImporter ssOutboundFromSSLink:inputStr];
Expand All @@ -321,7 +323,7 @@ - (void)presentImportResultOfVmessCount:(NSInteger)vmessCount otherCount:(NSInte
dispatch_async(dispatch_get_main_queue(), ^{
[self->_profileTable reloadData];
self.popover = [[NSPopover alloc] init];
self.importMessageField.stringValue = [NSString stringWithFormat:@"imported %lu vmess and %lu other protocol outbounds, %lu routing sets.", vmessCount, otherCount, ruleSetCount];
self.importMessageField.stringValue = [NSString stringWithFormat:@"Imported %lu vmess and %lu other protocol outbounds, %lu routing rule sets.", vmessCount, otherCount, ruleSetCount];
self.popover.contentViewController = [[NSViewController alloc] init];
self.popover.contentViewController.view = self.importResultView;
self.popover.behavior = NSPopoverBehaviorTransient;
Expand All @@ -331,7 +333,7 @@ - (void)presentImportResultOfVmessCount:(NSInteger)vmessCount otherCount:(NSInte
}

- (IBAction)importFromMiscLinks:(id)sender {
[self askInputWithPrompt:@"Please input the link" handler:^(NSString *inputStr) {
[self askInputWithPrompt:@"V2RayX will try importing vmess:// and http(s):// links from v2rayN ." handler:^(NSString *inputStr) {
if ([inputStr length] != 0) {
ServerProfile* p = [ConfigImporter importFromVmessOfV2RayN:inputStr];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
Expand Down

0 comments on commit ff57615

Please sign in to comment.